<template>
    <div>
        <el-tabs v-model="activeName" >
            <el-tab-pane label="修改信息" name="basic">
            <el-form ref="formSystem" :model="formSystem" label-width="120px">

            <el-form-item label="账号">
            <el-input ref="name" v-model="formSystem.username" placeholder="请输入账号"></el-input>
            </el-form-item>
            <el-form-item label="密码">
            <el-input ref="name" v-model="formSystem.password" type="password" placeholder="请输入密码"></el-input>
            </el-form-item>

            <el-form-item>
            <el-button type="success" icon="el-icon-check" @click="submitSystem">修改</el-button>
            </el-form-item>
            </el-form>
            </el-tab-pane>
            </el-tabs>
    </div>


</template>

<script>
    import {
        post
    } from '@/network/request'
    import {
        __URL__
    } from '@/main'

    export default {
        name: 'Login',
        data() {
            return {
                activeName: 'basic',
                formSystem: {
                    username: '',
                    password: '',
                }
            }
        },
        created: function () {
            this.getSystem()
        },
        methods: {
            //获取信息
            getSystem(){
                // 获取信息
                post('/getPassword', {
                    id: sessionStorage.getItem('id')
                }).then(res => {
                    const result = res.data
                        this.formSystem.username = result.username;
                        this.formSystem.password = result.password;
                        
                }).catch()
            },
            //修改密码
            submitSystem(){
                post('/updatePassword', {
                    id: sessionStorage.getItem('id')
                    username:this.username
                    password:this.password
                }).then(res => {
                    const result = res.data
                        
                }).catch()
            },
        }
    }
</script>

<style>
</style>